require 'mongowiki'

def test_output_file(filename, infolist)
  File.open(filename, 'w') do |io|
    infolist.each do |info|
      io.puts "Title: #{info[:title]}"
      io.puts "URL: #{info[:url]}"
      io.puts "Keywords: #{info[:keywords].join(',')},"
      io.puts "Links:"
      info[:links].each { |l| io.puts l }
  
      io.puts "\nCitations:"
      info[:citations].each { |c| io.puts c }
      io.print "\n"
    end
  end
  
  File.new(filename)
end